Run fuzzing during cargo test; reorganize fuzzers#244
Run fuzzing during cargo test; reorganize fuzzers#244abrown merged 4 commits intobytecodealliance:mainfrom
cargo test; reorganize fuzzers#244Conversation
This change moves the meat of the code for fuzzing `regalloc2` into the main crate's `fuzzing` module. This has several minor benefits (easier to find, better LSP detection, same workspace for `cargo fmt|clippy`) but the major one is we can not only build, but also _run_ some fuzz tests with: ``` cargo test --features fuzzing ``` The fuzz modules now use `arbtest` to run one second worth of fuzzing. This should be helpful both during development and in CI. The second part of this change is a reorganization of the fuzz targets themselves. In looking at them carefully, I realized: - `ion` and `ion_checker` were doing essentially the same thing; in fact, we probably always want to run the checker after allocation - `ssagen` was not necessary: we could get the same functionality by flipping the `enable_ssa_checker` flag on `fastalloc|ion::run()` - we never fuzzed with annotations off (not sure why we would not want to but... shrug) This led to randomly flipping the annotations and SSA checking flags, renaming `ion_checker.rs -> ion.rs` (replacing `ion.rs`) and `fastalloc_checker.rs -> fastalloc.rs`. `ssagen.rs` is now gone, subsumed by now being able to check the SSA in both `ion.rs` and `fastalloc.rs`. This naming change will undoubtedly require some re-configuration in OSSFuzz but that can happen later.
e158c1d to
7944686
Compare
Now that we can run the fuzzers with `arbtest`, we use `cargo test --all-features` to run all of these for one second. This allows cleaning up the building of the fuzz targets themselves and the static set of smoke tests in `*.bin` for the old `ion_checker`.
4f1eb8f to
f725a88
Compare
|
@cfallin, I went back and forth on removing the The other incomplete part with this PR is the documentation in |
The target was largely written for the purpose of early bring-up, i.e., ensuring that the fuzzing function generation itself was generating valid CFGs with SSA; but now that we have that tested via the higher levels, indeed, I don't think we need it. |
cfallin
left a comment
There was a problem hiding this comment.
Thanks! I think this is good code motion -- just one tweak below.
Now-upstreamed changes require the `Options` structure to define more fields. We use a `const` variable here (versus `impl Default`) so it can be used in other `const` contexts.
This change coordinates a name change to `regalloc2`'s fuzz targets introduced in [google#244]. The `ion_checker` target is now simply named `ion`. [google#244]: bytecodealliance/regalloc2#244
This change coordinates a name change to `regalloc2`'s fuzz targets introduced in [google#244]. The `ion_checker` target is now simply named `ion`. [google#244]: bytecodealliance/regalloc2#244
This change coordinates a name change to `regalloc2`'s fuzz targets introduced in [#244]. The `ion_checker` target is now simply named `ion`. [#244]: bytecodealliance/regalloc2#244
This change moves the meat of the code for fuzzing
regalloc2into the main crate'sfuzzingmodule. This has several minor benefits (easier to find, better LSP detection, same workspace forcargo fmt|clippy) but the major one is we can not only build, but also run some fuzz tests with:The fuzz modules now use
arbtestto run one second worth of fuzzing. This should be helpful both during development and in CI.The second part of this change is a reorganization of the fuzz targets themselves. In looking at them carefully, I realized:
ionandion_checkerwere doing essentially the same thing; in fact, we probably always want to run the checker after allocationssagenwas not necessary: we could get the same functionality by flipping theenable_ssa_checkerflag onfastalloc|ion::run()This led to randomly flipping the annotations and SSA checking flags, renaming
ion_checker.rs -> ion.rs(replacingion.rs) andfastalloc_checker.rs -> fastalloc.rs.ssagen.rsis now gone, subsumed by now being able to check the SSA in bothion.rsandfastalloc.rs.This naming change will undoubtedly require some re-configuration in OSSFuzz but that can happen later.